home *** CD-ROM | disk | FTP | other *** search
- Path: news.mindlink.net!news
- From: Allan_Nienhuis@mindlink.bc.ca (Allan Nienhuis)
- Newsgroups: comp.lang.c,comp.lang.c++
- Subject: Re: H E L P
- Date: Fri, 05 Apr 1996 15:32:24 GMT
- Organization: MIND LINK! - British Columbia, Canada
- Message-ID: <4k3e8g$4e4@fountain.mindlink.net>
- References: <N.040296.013047.18@DynamicPPP-185.HIP.CAM.ORG> <Pine.A32.3.91.960402135001.121719B-100000@green.weeg.uiowa.edu> <4js6jh$ndr@solutions.solon.com> <DpAx1J.4n9@iquest.net>
- NNTP-Posting-Host: line012.abb.mindlink.net
- X-Newsreader: Forte Free Agent 1.0.82
-
- dlmiller@iquest.net (Doug Miller) wrote:
-
- >seebs@solutions.solon.com (Peter Seebach) wrote:
- [snip]
- >>This is a bit strong. You don't *need* a loop. You just probably want one.
- >>
- [snip]
- >Obviously you didn't read what he wrote. To satisfy the conditions of the task as he stated it,
- >he would need an infinite number of ifs ("whatever number I enter..."). I saw nothing in his
- >statement of the task that placed any limits of any sort on the number -- thus, he *does* need
- >a loop.
-
- Sorry, your wrong. Try this:
-
- ////////////////////////////////////////////////////////////////////////////////
- #include <stdlib.h>
- #include <iostream.h>
-
- void main()
- {
- long i = 0;
- char Happyface = '▄';
- char far *String;
-
- do
- {
- cout << "number? (0 to end) >"; cin >> i;
- if(!(String = new char[i])) break;
- _fmemset(String,Happyface,i);
- String[i]=NULL;
- cout << String << "\n\n";
- delete[] String;
- } while (!(i==0));
-
- cout << "Have a nice day! ▄\n";
- }
- ////////////////////////////////////////////////////////////////////////////////
-
- I know, memset uses a loop, but HE doesnt' need to!
-
-
-